package com.tuanzi.loan.workflow.listener;

import org.activiti.engine.delegate.event.ActivitiEvent;
import org.springframework.stereotype.Component;

/**
 * @author Ray
 * @date 2018/01/12
 */
@Component
public class FormManageValidationListener implements WorkflowListener {

	// @Resource
	// private FormBindingService formBindingService;
	//
	// @Resource
	// private FormAttributeService formAttributeService;

	@Override
	public void onEvent(ActivitiEvent event) {
		// if (ActivitiEventType.PROCESS_STARTED.equals(event.getType())) {
		// String procDefId = event.getProcessDefinitionId();
		// FormBindingQueryRequest formBindingQueryRequest = new
		// FormBindingQueryRequest();
		// DatatablesPageResponse<FormBindingQueryResponse> formBandingResponse =
		// formBindingService.listFormBanding(formBindingQueryRequest);
		//
		// if (CollectionUtils.isEmpty(formBandingResponse.getData())) {
		// throw new ServiceException(ErrorResponseEnum.SYSTEM_ERROR.getCode(),
		// "表单绑定未配置");
		// }
		//
		// FormAttributeQueryRequest formAttributeQueryRequest = new
		// FormAttributeQueryRequest();
		// formAttributeQueryRequest.setProcDefId(procDefId);
		// BaseResponse<FormAttributeListResponse> formAttributeListResponse =
		// formAttributeService.listFormAttributeByField(formAttributeQueryRequest);
		//
		// if
		// (CollectionUtils.isEmpty(formAttributeListResponse.getResult().getData().getFormAttributeResponseList()))
		// {
		// throw new ServiceException(ErrorResponseEnum.SYSTEM_ERROR.getCode(),
		// "表单属性未配置");
		// }
		//
		// }
	}

	@Override
	public boolean isFailOnException() {
		return true;
	}
}
